package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 插入数据
     * @param user
     */
    void insert(User user);
    /**
     * 查询每天的新增用户数量和总数据量
     * 查询每天的新增用户sql: select count(id) from user where create_time>=#{begin} and create_time<=#{end}
     * 查询每天的总用户数量sql: select count(id) from user where create_time<=#{end}
     * @param map {"begin":'',"end":''}
     * @return
     */
    Integer getUserCount(Map map);

}
